import request from '@/utils/request'

// 获取电表列表
export function getMeterApi(pageNum, pageSize, description, iccid, imei, landlordPhone, meterNumber, modelIds, online, productId, status, tenantId, ver, vers, meterType, meterName, meterAddress, startDate, endDate) {
    return request({
        url: '/sys/device/meter',
        method: 'get',
        params: { pageNum, pageSize, description, iccid, imei, landlordPhone, meterNumber, modelIds, online, productId, status, tenantId, ver, vers, meterType, meterName, meterAddress, startDate, endDate }
    })
}

// 获取单一电表
export function getOneMeterApi(id) {
    return request({
        url: `/sys/device/meter/${id}`,
        method: 'get',
    })
}
// 获取生产产商
export function getProductApi() {
    return request({
        url: `/sys/device/meter/products`,
        method: 'get',
    })
}
// 获取租户列表
export function getTenantsApi() {
    return request({
        url: `/sys/device/meter/teannts`,
        method: 'get',
    })
}
// 修改备注
export function editDesApi(id, data) {
    return request({
        url: `/sys/device/meter/${id}`,
        method: 'put',
        data
    })
}
// 获取工单列表
export function getTaskApi() {
    return request({
        url: `/sys/device/meter/otaTask`
    })
}
// 升级
export function upDateApi(id, data) {
    return request({
        url: `/sys/device/meter/${id}/ota`,
        method: 'post',
        data
    })
}
//抄表
export function copyApi(id) {
    return request({
        url: `/mini/common/meter/fg/${id}/read`,
        method: 'post',
    })
}
// 升级记录
export function upDateRecordApi(id, pageNum, pageSize, taskName) {
    return request({
        url: `/sys/device/meter/${id}/ota`,
        params: { pageNum, pageSize, taskName }
    })
}
// 重启
export function reloadApi(id) {
    return request({
        url: `/sys/device/meter/${id}/reset`,
        method: 'post'
    })
}
// 自定义
export function customApi(id, data) {
    return request({
        url: `/sys/device/meter/${id}/custom`,
        method: 'post',
        data
    })
}
// 获取电表状态信息
export function getStatusApi(pageNum, pageSize, meterNumber, startDate, endDate, status) {
    return request({
        url: `/sys/device/status`,
        method: 'get',
        params: { pageNum, pageSize, meterNumber, startDate, endDate, status }
    })
}
// 获取掉线电表排名
export function getStatusRankApi(pageNum, pageSize, meterNumber, startDate, endDate, status) {
    return request({
        url: `/sys/device/status/rank`,
        method: 'get',
        params: { pageNum, pageSize, meterNumber, startDate, endDate, status }
    })
}
// 分页查询生产账户
export function getRecordApi(pageNum, pageSize, startDate, endDate, landlordPhone, meterNumber, meterType, productId, rechargeHuifuOrder, rechargeOrder, rechargeWay, tenantId) {
    return request({
        url: '/sys/order/record',
        method: 'get',
        params: { pageNum, pageSize, startDate, endDate, landlordPhone, meterNumber, meterType, productId, rechargeHuifuOrder, rechargeOrder, rechargeWay, tenantId }
    })
}
// 获取生产账户列表
export function getProductIdApi() {
    return request({
        url: '/sys/order/record/products'
    })
}
// 获取租户列表
export function getTenantApi() {
    return request({
        url: '/sys/order/record/teannts'
    })
}
// 导出
export function outOrderApi(pageNum, pageSize, startDate, endDate, landlordPhone, meterNumber, meterType, productId, rechargeHuifuOrder, rechargeOrder, rechargeWay, tenantId) {
    return request({
        url: '/sys/order/record/export',
        method: 'get',
        responseType: 'blob',
        params: { pageNum, pageSize, startDate, endDate, landlordPhone, meterNumber, meterType, productId, rechargeHuifuOrder, rechargeOrder, rechargeWay, tenantId }
    })
}
// 导出状态排名
export function outRankApi(pageNum, pageSize, meterNumber, startDate, endDate, online) {
    return request({
        url: '/sys/device/status/rank/export',
        method: 'get',
        responseType: 'blob',
        params: { pageNum, pageSize, meterNumber, startDate, endDate, online }
    })
}
// 获取硬件类型
export function getHardWareApi() {
    return request({
        url: '/sys/device/meter/ver'
    })
}
// 获取型号列表
export function getModelApi() {
    return request({
        url: '/mini/server/meter/model'
    })
}
// 纠正水量
export function postWaterApi(id,data) {
    return request({
        url: `/sys/device/meter/${id}/isMulti`,
        method:'post',
        data
    })
}
